#include<bits/stdc++.h>
using namespace std;

int n,ans=0;
string s;

int main() {
	cin >> n;
	cin >> s;
	for(int i = 0; i < n; i++) {
		if (s[i]=='V'&&s[i+1]=='K') {
			ans++;
			s[i] = 'x';
			s[i+1] = 'x';
		}
	}
	for(int i = 0; i < n; i++) {
		if (s[i+1] == s[i] && s[i] != 'x') {
			ans++;
			cout<<ans;
			return 0;
		}
	}
	cout << ans;
	return 0;
}

